package com.imooc;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport;

/**
 * @version 1.0
 * @Author Mr.Yang
 * @Date 2024-08-27 16:49
 * @question: 添加静态资源映射的路径,css/js/html等都可以放在其中进行虚拟化
 */

@Configuration
public class StaticResourceConfig extends WebMvcConfigurationSupport {

    @Override
    protected void addResourceHandlers(ResourceHandlerRegistry registry) {

        /**
         * addResourceHandler: 指的对外暴露的访问路径 任何以/static/开头的URL请求都应该被视为对静态资源的请求
         * addResourceLocations: 指的是文件配置的本地系统目录
         */
        registry.addResourceHandler("/static/**")
                .addResourceLocations("file:E:/MuPinWang/");

        super.addResourceHandlers(registry);
    }

}
